package com.example.demo.controller;


import com.baomidou.mybatisplus.plugins.Page;
import com.example.demo.core.annotation.Log;
import com.example.demo.core.result.CommonResult;
import com.example.demo.core.utils.ResultUtils;
import com.example.demo.repository.entity.Activity;
import com.example.demo.service.IActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 活动 前端控制器
 * </p>
 *
 * @author kin
 * @since 2017-11-30
 */
@RestController
@RequestMapping("/api/activity")
public class ActivityController {

    private final IActivityService activityService;

    @Autowired
    public ActivityController(IActivityService activityService) {
        this.activityService = activityService;
    }


    @Log
    @RequestMapping(value = "getAll", method = RequestMethod.GET)
    public CommonResult getAll(@RequestParam(value = "pageSize", required = false, defaultValue = "20") int pageSize) {
        //return ResultUtils.ok(activityService.selectPage(new Page<>(1, pageSize)));
        return ResultUtils.error();
    }

    @RequestMapping(value = "getAllPost", method = RequestMethod.POST)
    public Page<Activity> getAllPost() {
        return activityService.selectPage(new Page<>(1, 1));

    }

}

